<div class="tpl-content-page-title">注册会员</div>
<ol class="am-breadcrumb">
	<li><a href="#" class="am-icon-home">首页</a></li>
	<li><a href="#">云造型会员</a></li>
	<li class="am-active">添加会员</li>
</ol>
<div class="tpl-portlet-components">
	<div class="portlet-title">
		 <div class="caption font-green bold">
			<span class="am-icon-code"></span> 注册会员
		</div> 

	</div>
	<div class="tpl-block ">

		<div class="am-g tpl-amazeui-form">

			<div class="am-u-sm-12 am-u-md-9">
				<form class="am-form am-form-horizontal">
					<div class="am-form-group">
						<label for="user-name" class="am-u-sm-3 am-form-label">会员名称
							</label>
						<div class="am-u-sm-9">
							<input type="text" id="member-name" placeholder="请输入会员名称">
						</div>
					</div>
					
					<div class="am-form-group">
						<label for="user-name" class="am-u-sm-3 am-form-label">会员密码
							</label>
						<div class="am-u-sm-9">
							<input type="text" id="member-pwd" placeholder="请输入密码">
						</div>
					</div>
					
					<div class="am-form-group">
						<label for="user-name" class="am-u-sm-3 am-form-label">手机号码
							</label>
						<div class="am-u-sm-9">
							<input type="text" id="member-mobile" placeholder="请输入手机号码">
						</div>
					</div>
					
					<div class="am-form-group">
						<label for="user-name" class="am-u-sm-3 am-form-label">邮箱
							</label>
						<div class="am-u-sm-9">
							<input type="email" id="member-email" placeholder="请输入邮箱">
						</div>
					</div>
					
					<div class="am-form-group">
						<label for="user-name" class="am-u-sm-3 am-form-label">账户余额
							</label>
						<div class="am-u-sm-9">
							<input type="text" id="member-account" placeholder="请充值账户">
						</div>
					</div>
					
					<div class="am-form-group">
						<div class="am-u-sm-9 am-u-sm-push-3">
							<button type="button" class="am-btn am-btn-cancel">返回列表</button>
							<button type="button" class="am-btn am-btn-add-member">保存会员</button>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</div>

<script type="text/javascript">

$(function(){
	$(".am-btn-add-member").click(doSaveMember)
	$(".am-btn-cancel").click(doCancel)
})


// 返回订单页面
function doCancel(){
	$(".tpl-content-wrapper").load("member-info.html");
}

 // 保存订单信息
function doSaveMember(){
	 debugger
	 //1.url
	 var insertUrl="member/doSaveObject";
	 //2.获取表单数据
	 var params=doGetEditFormData();
	 //3.发起异步请求
	 $.post(insertUrl,params,function(result){
		 if(result.state==1){
			 alert(result.message);
			 doCancel();
		 }else{
			 alert(result.message);
		 }
	 })
 } 
 
//获取用户输入的表单数据
function doGetEditFormData(){
	 var params={
	      "memberName":$("#member-name").val(),
	      "password":$("#member-pwd").val(),
	      "mobile":$("#member-mobile").val(),
	      "email":$("#member-email").val(),
          "account":$("#member-account").val()
          }
	return params;
} 
 
</script>














